dhtmlXTreeObject.prototype.enableContextMenu = function(menu) {
    if (menu)
        this.cMenu = menu
};
dhtmlXTreeObject.prototype.clearSelection = function(itemId) {
    if (itemId)
        this._unselectItem(this._globalIdStorageFind(itemId));
    else
        this._unselectItems()
};
dhtmlXTreeObject.prototype.enableAutoTooltips = function(mode) {
    this.ettip = convertStringToBoolean(mode)
};
dhtmlXTreeObject.prototype.enableDistributedParsing = function(mode, count, delay) {
    this._edsbps = convertStringToBoolean(mode);
    this._edsbpsA = new Array();
    this.afa = count || 10;
    this.afv = delay || 250
};
dhtmlXTreeObject.prototype.enableMercyDrag = function(mode) {
    this.dpcpy = convertStringToBoolean(mode)
};
dhtmlXTreeObject.prototype.enableMultiLineItems = function(width) {
    if (width === true)
        this.mlitems = "100%";
    else
        this.mlitems = width
};
dhtmlXTreeObject.prototype.enableMultiselection = function(mode, strict) {
    this.Wj = convertStringToBoolean(mode);
    this.aim = convertStringToBoolean(strict)
};
dhtmlXTreeObject.prototype.enableRadioButtons = function(itemId, mode) {
    if (arguments.length == 1) {
        this._frbtr = convertStringToBoolean(itemId);
        this.checkBoxOff = this.checkBoxOff || this._frbtr;
        return
    };
    var node = this._globalIdStorageFind(itemId);
    if (!node)
        return "";
    mode = convertStringToBoolean(mode);
    if ((mode) && (!node._r_logic)) {
        node._r_logic = true;
        for (var i = 0; i < node.childsCount; i++)
            this._setCheck(node.childNodes[i], node.childNodes[i].checkstate)
    };
    if ((!mode) && (node._r_logic)) {
        node._r_logic = false;
        for (var i = 0; i < node.childsCount; i++)
            this._setCheck(node.childNodes[i], node.childNodes[i].checkstate)
    }
};
dhtmlXTreeObject.prototype.enableSingleRadioMode = function(mode) {
    this._frbtrs = convertStringToBoolean(mode)
};
dhtmlXTreeObject.prototype.enableSmartCheckboxes = function(mode) {
    this.smcheck = convertStringToBoolean(mode)
};
dhtmlXTreeObject.prototype.enableSmartXMLParsing = function(mode) {
    this.slowParse = convertStringToBoolean(mode)
};
dhtmlXTreeObject.prototype.enableTextSigns = function(mode) {
    this._txtimg = convertStringToBoolean(mode)
};
dhtmlXTreeObject.prototype.findItem = function(searchStr, direction, top) {
    var z = this.Cj(searchStr, direction, (top ? this.htmlNode : null));
    if (z) {
        this.selectItem(z.id, true);
        this._focusNode(z);
        return z.id
    } else
        return null
};
dhtmlXTreeObject.prototype.Cj = function(searchStr, direction, dK) {
    var searchStr = searchStr.replace(new RegExp("^( )+"), "").replace(new RegExp("( )+$"), "");
    searchStr = new RegExp(searchStr.replace(/([\?\*\+\\\[\]\(\)]{1})/gi, "\\$1").replace(/ /gi, ".*"), "gi");
    if (!dK) {
        dK = this._selected[0];
        if (!dK)
            dK = this.htmlNode
    };
    var An = dK;
    if (!direction) {
        if ((dK.unParsed) && (this.sy(dK.unParsed.d, "text", searchStr)))
            this.tK(dK);
        dK = this._getNextNode(An);
        if (dK == -1)
            dK = this.htmlNode.childNodes[0]
    } else {
        var z2 = this._getPrevNode(An);
        if (z2 == -1)
            z2 = this._lastChild(this.htmlNode);
        if ((z2.unParsed) && (this.sy(z2.unParsed.d, "text", searchStr))) {
            this.tK(z2);
            dK = this._getPrevNode(An)
        } else
            dK = z2;
        if (dK == -1)
            dK = this._lastChild(this.htmlNode)
    };
    while ((dK) && (dK != An)) {
        if ((dK.label) && (dK.label.search(searchStr) != -1))
            return (dK);
        if (!direction) {
            if (dK == -1) {
                if (An == this.htmlNode)
                    break;
                dK = this.htmlNode.childNodes[0]
            };
            if ((dK.unParsed) && (this.sy(dK.unParsed.d, "text", searchStr)))
                this.tK(dK);
            dK = this._getNextNode(dK);
            if (dK == -1)
                dK = this.htmlNode
        } else {
            var z2 = this._getPrevNode(dK);
            if (z2 == -1)
                z2 = this._lastChild(this.htmlNode);
            if ((z2.unParsed) && (this.sy(z2.unParsed.d, "text", searchStr))) {
                this.tK(z2);
                dK = this._getPrevNode(dK)
            } else
                dK = z2;
            if (dK == -1)
                dK = this._lastChild(this.htmlNode)
        }
    };
    return null
};
dhtmlXTreeObject.prototype.findItemIdByLabel = function(searchStr, direction, top) {
    var z = this.Cj(searchStr, direction, (top ? this.htmlNode : null));
    if (z)
        return z.id;
    else
        return null
};
dhtmlXTreeObject.prototype.getDistributedParsingState = function() {
    return (!((!this._edsbpsA) || (!this._edsbpsA.length)))
};
dhtmlXTreeObject.prototype.getItemImage = function(itemId, agI, agb) {
    var node = this._globalIdStorageFind(itemId);
    if (!node)
        return "";
    var img = node.images[agI || 0];
    if (agb)
        img = this.iconURL + img;
    return img
};
dhtmlXTreeObject.prototype.getItemParsingState = function(itemId) {
    var z = this._globalIdStorageFind(itemId, true, true);
    if (!z)
        return 0;
    if (this._edsbpsA)
        for (var i = 0; i < this._edsbpsA.length; i++)
            if (this._edsbpsA[i][2] == itemId)
                return -1;
    return 1
};
dhtmlXTreeObject.prototype.getXMLState = function() {
    return (this.xmlstate == 1)
};
